
from google.appengine.ext import db
from google.appengine.api import users


class Song(db.Model):
    songname=db.StringProperty()
    timesplayed=db.IntegerProperty(default=1)
    
""" References - Song
Ancestor - UIP """
class SongInPlaylist(db.Model):
    song_ref=db.ReferenceProperty(Song,
                                  collection_name="song")
    order=db.IntegerProperty(default=0)
    
class UserInPlaylist(db.Model):
    user=db.UserProperty(auto_current_user=True)

class ActiveUser(db.Model):
    user=db.UserProperty(auto_current_user=True)

# There should be only one entity of this kind
class Client(db.Model):
    client_id=db.StringProperty()
    local_server_ip=db.StringProperty()
    secret_key=db.StringProperty()
    ip=db.StringProperty()

class UserStat(db.Model):
    user=db.UserProperty(auto_current_user=True)
    timesloggedin=db.IntegerProperty(default=1)
    lastlogin=db.DateTimeProperty(auto_now=True)
